package com.trendrr.nsq.lookup;

import com.trendrr.nsq.ConnectionAddress;
import com.trendrr.nsq.NSQLookup;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class LocalLookup implements NSQLookup {
    private int port;

    public LocalLookup(int port) {
        this.port = port;
    }

    public void addAddr(String addr, int port){

    }

    public List<ConnectionAddress> lookup(String topic) {
        HashMap<String, ConnectionAddress> addresses = new HashMap<String, ConnectionAddress>();


        ConnectionAddress address = new ConnectionAddress();
        address.setHost("localhost");
        address.setPort(this.port);
        addresses.put("localhost:" + this.port, address);

        return new ArrayList<ConnectionAddress>(addresses.values());
    }

}
